import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 计费配置
 */
@Entity('billing_config')
export class BillingConfigEntity extends BaseEntity {
  @Index({ unique: true })
  @Column({ comment: '服务类型', dict: ['短信通知', '语音通知', '物联网卡年费', '流量包'], default: 0 })
  serviceType: number;

  @Column({ comment: '服务名称', default: '' })
  serviceName: string;

  @Column({ 
    comment: '单价', 
    type: 'decimal', 
    precision: 10, 
    scale: 4,
    default: 0 
  })
  unitPrice: number;

  @Column({ comment: '计费单位', nullable: true })
  unit: string;

  @Column({ comment: '是否启用', default: true })
  isEnabled: boolean;

  @Column({ comment: '最小计费单位', default: 1 })
  minUnit: number;

  @Column({ comment: '描述', type: 'text', nullable: true })
  description: string;

  @Column({ comment: '生效时间', nullable: true })
  effectiveTime: Date;

  @Column({ comment: '失效时间', nullable: true })
  expireTime: Date;

  @Column({ comment: '排序', default: 0 })
  sort: number;

  @Column({ comment: '备注', type: 'text', nullable: true })
  remark: string;
}